package CircularBufferProducerConsumer;

import java.util.concurrent.TimeUnit;

public class Producer implements Runnable {
	private Buffer buffer;
	private static volatile int pushNum;

	public Producer(Buffer buffer) {

		this.buffer = buffer;
	}

	@Override
	public void run() {

		for (;;) {
			buffer.push(pushNum++);
			try {
				TimeUnit.MILLISECONDS.sleep(600);
			} catch (InterruptedException e) {

				e.printStackTrace();
			}

		}

	}

}
